home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6367 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  2.3 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 62 6c | 61 63 6b 2e 77 65 65 67 |Path: bl|ack.weeg|
|00000010| 2e 75 69 6f 77 61 2e 65 | 64 75 21 72 6f 62 69 6e |.uiowa.e|du!robin|
|00000020| 73 6f 6e 0a 46 72 6f 6d | 3a 20 54 68 65 20 41 6d |son.From|: The Am|
|00000030| 6f 72 70 68 6f 75 73 20 | 4d 61 73 73 20 3c 72 6f |orphous |Mass <ro|
|00000040| 62 69 6e 73 6f 6e 40 62 | 6c 75 65 2e 77 65 65 67 |binson@b|lue.weeg|
|00000050| 2e 75 69 6f 77 61 2e 65 | 64 75 3e 0a 4e 65 77 73 |.uiowa.e|du>.News|
|00000060| 67 72 6f 75 70 73 3a 20 | 63 6f 6d 70 2e 6c 61 6e |groups: |comp.lan|
|00000070| 67 2e 63 0a 53 75 62 6a | 65 63 74 3a 20 52 65 3a |g.c.Subj|ect: Re:|
|00000080| 20 5b 51 5d 20 44 6f 65 | 73 20 66 72 65 65 28 29 | [Q] Doe|s free()|
|00000090| 20 77 6f 72 6b 3f 0a 44 | 61 74 65 3a 20 46 72 69 | work?.D|ate: Fri|
|000000a0| 2c 20 32 33 20 46 65 62 | 20 31 39 39 36 20 32 33 |, 23 Feb| 1996 23|
|000000b0| 3a 34 37 3a 32 37 20 2d | 30 36 30 30 0a 4f 72 67 |:47:27 -|0600.Org|
|000000c0| 61 6e 69 7a 61 74 69 6f | 6e 3a 20 55 6e 69 76 65 |anizatio|n: Unive|
|000000d0| 72 73 69 74 79 20 6f 66 | 20 49 6f 77 61 2c 20 49 |rsity of| Iowa, I|
|000000e0| 6f 77 61 20 43 69 74 79 | 2c 20 49 41 2c 20 55 53 |owa City|, IA, US|
|000000f0| 41 0a 44 69 73 74 72 69 | 62 75 74 69 6f 6e 3a 20 |A.Distri|bution: |
|00000100| 77 6f 72 6c 64 0a 4d 65 | 73 73 61 67 65 2d 49 44 |world.Me|ssage-ID|
|00000110| 3a 20 3c 50 69 6e 65 2e | 41 33 32 2e 33 2e 39 31 |: <Pine.|A32.3.91|
|00000120| 2e 39 36 30 32 32 33 32 | 33 33 35 32 36 2e 31 31 |.9602232|33526.11|
|00000130| 33 34 38 32 44 2d 31 30 | 30 30 30 30 40 62 6c 61 |3482D-10|0000@bla|
|00000140| 63 6b 2e 77 65 65 67 2e | 75 69 6f 77 61 2e 65 64 |ck.weeg.|uiowa.ed|
|00000150| 75 3e 0a 52 65 66 65 72 | 65 6e 63 65 73 3a 20 3c |u>.Refer|ences: <|
|00000160| 34 67 6d 33 73 73 24 71 | 66 61 40 6e 65 77 73 2e |4gm3ss$q|fa@news.|
|00000170| 69 6e 66 6f 73 65 72 76 | 65 2e 6e 65 74 3e 0a 4e |infoserv|e.net>.N|
|00000180| 4e 54 50 2d 50 6f 73 74 | 69 6e 67 2d 48 6f 73 74 |NTP-Post|ing-Host|
|00000190| 3a 20 62 6c 61 63 6b 2e | 77 65 65 67 2e 75 69 6f |: black.|weeg.uio|
|000001a0| 77 61 2e 65 64 75 0a 4d | 69 6d 65 2d 56 65 72 73 |wa.edu.M|ime-Vers|
|000001b0| 69 6f 6e 3a 20 31 2e 30 | 0a 43 6f 6e 74 65 6e 74 |ion: 1.0|.Content|
|000001c0| 2d 54 79 70 65 3a 20 54 | 45 58 54 2f 50 4c 41 49 |-Type: T|EXT/PLAI|
|000001d0| 4e 3b 20 63 68 61 72 73 | 65 74 3d 55 53 2d 41 53 |N; chars|et=US-AS|
|000001e0| 43 49 49 0a 58 2d 53 65 | 6e 64 65 72 3a 20 72 6f |CII.X-Se|nder: ro|
|000001f0| 62 69 6e 73 6f 6e 40 62 | 6c 61 63 6b 2e 77 65 65 |binson@b|lack.wee|
|00000200| 67 2e 75 69 6f 77 61 2e | 65 64 75 0a 49 6e 2d 52 |g.uiowa.|edu.In-R|
|00000210| 65 70 6c 79 2d 54 6f 3a | 20 3c 34 67 6d 33 73 73 |eply-To:| <4gm3ss|
|00000220| 24 71 66 61 40 6e 65 77 | 73 2e 69 6e 66 6f 73 65 |$qfa@new|s.infose|
|00000230| 72 76 65 2e 6e 65 74 3e | 20 0a 0a 4f 6e 20 32 34 |rve.net>| ..On 24|
|00000240| 20 46 65 62 20 31 39 39 | 36 2c 20 53 75 6e 67 20 | Feb 199|6, Sung |
|00000250| 4d 6f 6f 20 59 61 6e 67 | 20 77 72 6f 74 65 3a 0a |Moo Yang| wrote:.|
|00000260| 0a 20 20 50 6c 65 61 73 | 65 20 6c 69 6d 69 74 20 |. Pleas|e limit |
|00000270| 79 6f 75 72 20 6c 69 6e | 65 20 6c 65 6e 67 74 68 |your lin|e length|
|00000280| 73 20 74 6f 20 37 35 20 | 63 68 61 72 61 63 74 65 |s to 75 |characte|
|00000290| 72 73 2e 0a 0a 3e 20 51 | 75 65 73 74 69 6f 6e 20 |rs...> Q|uestion |
|000002a0| 6f 6e 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 20 |on the f|unction |
|000002b0| 66 72 65 65 28 29 20 69 | 6e 20 4d 53 43 20 35 2e |free() i|n MSC 5.|
|000002c0| 31 20 72 75 6e 6e 69 6e | 67 20 6f 6e 20 4d 53 2d |1 runnin|g on MS-|
|000002d0| 44 4f 53 20 36 2e 30 20 | 6f 6e 20 34 38 36 20 44 |DOS 6.0 |on 486 D|
|000002e0| 58 32 2e 0a 3e 20 0a 3e | 20 54 68 65 20 6c 69 62 |X2..> .>| The lib|
|000002f0| 72 61 72 79 20 66 75 6e | 63 74 69 6f 6e 20 66 72 |rary fun|ction fr|
|00000300| 65 65 28 29 20 64 6f 65 | 73 6e 27 74 20 66 72 65 |ee() doe|sn't fre|
|00000310| 65 20 6d 65 6d 6f 72 79 | 20 61 6c 6c 6f 63 61 74 |e memory| allocat|
|00000320| 65 64 20 68 6f 77 65 76 | 65 72 20 0a 3e 20 5f 64 |ed howev|er .> _d|
|00000330| 6f 73 5f 66 72 65 65 6d | 65 6d 28 29 20 64 6f 65 |os_freem|em() doe|
|00000340| 73 2e 20 20 45 78 61 6d | 70 6c 65 20 54 45 53 54 |s. Exam|ple TEST|
|00000350| 2e 43 20 75 73 65 73 20 | 66 72 65 65 28 29 20 74 |.C uses |free() t|
|00000360| 6f 20 72 65 6c 65 61 73 | 65 20 6d 65 6d 6f 72 79 |o releas|e memory|
|00000370| 20 77 68 69 6c 65 20 0a | 3e 20 54 45 53 54 32 2e | while .|> TEST2.|
|00000380| 43 20 75 73 65 73 20 5f | 64 6f 73 5f 66 72 65 65 |C uses _|dos_free|
|00000390| 6d 65 6d 28 29 20 74 6f | 20 64 6f 20 73 6f 2e 20 |mem() to| do so. |
|000003a0| 52 65 73 75 6c 74 20 73 | 63 72 65 65 6e 20 77 61 |Result s|creen wa|
|000003b0| 73 20 66 6f 6c 6c 6f 77 | 65 64 20 0a 3e 20 72 65 |s follow|ed .> re|
|000003c0| 73 70 65 63 74 69 76 65 | 6c 79 2e 20 20 57 68 79 |spective|ly. Why|
|000003d0| 20 64 6f 65 73 6e 27 74 | 20 66 72 65 65 28 29 20 | doesn't| free() |
|000003e0| 72 65 6c 65 61 73 65 20 | 74 68 65 20 6d 65 6d 6f |release |the memo|
|000003f0| 72 79 20 61 6c 6c 6f 63 | 61 74 65 64 3f 20 0a 0a |ry alloc|ated? ..|
|00000400| 20 20 6d 61 6c 6c 6f 63 | 28 29 2f 66 72 65 65 28 | malloc|()/free(|
|00000410| 29 20 69 73 20 66 72 65 | 65 20 3a 29 20 74 6f 20 |) is fre|e :) to |
|00000420| 65 6d 70 6c 6f 79 20 69 | 74 73 20 6f 77 6e 20 6d |employ i|ts own m|
|00000430| 65 6d 6f 72 79 20 6d 61 | 6e 61 67 65 6d 65 6e 74 |emory ma|nagement|
|00000440| 20 0a 70 61 63 6b 61 67 | 65 3b 20 41 46 49 41 4b | .packag|e; AFIAK|
|00000450| 20 61 20 63 6f 6d 66 6f | 72 6d 69 6e 67 20 69 6d | a comfo|rming im|
|00000460| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 20 63 6f 75 |plementa|tion cou|
|00000470| 6c 64 20 61 6c 6c 6f 63 | 61 74 65 20 61 6c 6c 20 |ld alloc|ate all |
|00000480| 74 68 65 20 6d 65 6d 6f | 72 79 20 0a 61 76 61 69 |the memo|ry .avai|
|00000490| 6c 61 62 6c 65 20 74 6f | 20 79 6f 75 72 20 70 72 |lable to| your pr|
|000004a0| 6f 63 65 73 73 20 61 6e | 64 20 74 68 65 6e 20 6d |ocess an|d then m|
|000004b0| 61 6c 6c 6f 63 28 29 20 | 61 6e 64 20 66 72 65 65 |alloc() |and free|
|000004c0| 28 29 20 66 72 6f 6d 20 | 74 68 61 74 2c 20 0a 61 |() from |that, .a|
|000004d0| 6c 74 68 6f 75 67 68 20 | 49 20 64 6f 6e 27 74 20 |lthough |I don't |
|000004e0| 74 68 69 6e 6b 20 74 68 | 69 73 20 69 73 20 63 6f |think th|is is co|
|000004f0| 6d 6d 6f 6e 6c 79 20 64 | 6f 6e 65 2e 20 3a 29 0a |mmonly d|one. :).|
|00000500| 20 20 45 73 73 65 6e 74 | 69 61 6c 6c 79 2c 20 61 | Essent|ially, a|
|00000510| 6c 6c 20 66 72 65 65 28 | 70 29 20 64 6f 65 73 20 |ll free(|p) does |
|00000520| 69 73 20 61 6c 6c 6f 77 | 20 74 68 65 20 62 6c 6f |is allow| the blo|
|00000530| 63 6b 20 6f 66 20 6d 65 | 6d 6f 72 79 20 70 6f 69 |ck of me|mory poi|
|00000540| 6e 74 65 64 20 74 6f 20 | 0a 62 79 20 70 20 74 6f |nted to |.by p to|
|00000550| 20 62 65 20 61 76 61 69 | 6c 61 62 6c 65 20 66 6f | be avai|lable fo|
|00000560| 72 20 61 6c 6c 6f 63 61 | 74 69 6f 6e 20 62 79 20 |r alloca|tion by |
|00000570| 6d 61 6c 6c 6f 63 28 29 | 20 28 69 74 20 61 6c 73 |malloc()| (it als|
|00000580| 6f 20 63 61 75 73 65 73 | 20 61 6e 79 20 0a 73 75 |o causes| any .su|
|00000590| 62 73 65 71 75 65 6e 74 | 20 64 65 72 65 66 65 72 |bsequent| derefer|
|000005a0| 65 6e 63 65 20 6f 66 20 | 70 20 74 6f 20 62 65 20 |ence of |p to be |
|000005b0| 72 65 73 75 6c 74 20 69 | 6e 20 75 6e 64 65 66 69 |result i|n undefi|
|000005c0| 6e 65 64 20 62 65 68 61 | 76 69 6f 72 2c 20 75 6e |ned beha|vior, un|
|000005d0| 74 69 6c 20 70 20 0a 61 | 67 61 69 6e 20 70 6f 69 |til p .a|gain poi|
|000005e0| 6e 74 73 20 74 6f 20 6d | 61 6c 6c 6f 63 28 29 27 |nts to m|alloc()'|
|000005f0| 64 20 6d 65 6d 6f 72 79 | 29 2e 20 20 49 74 20 64 |d memory|). It d|
|00000600| 6f 65 73 6e 27 74 20 68 | 61 76 65 20 74 6f 20 61 |oesn't h|ave to a|
|00000610| 63 74 75 61 6c 6c 79 20 | 0a 69 6d 6d 65 64 69 61 |ctually |.immedia|
|00000620| 74 65 6c 79 20 72 65 6c | 65 61 73 65 20 6d 65 6d |tely rel|ease mem|
|00000630| 6f 72 79 20 74 6f 20 74 | 68 65 20 6f 70 65 72 61 |ory to t|he opera|
|00000640| 74 69 6e 67 20 73 79 73 | 74 65 6d 2e 20 20 46 6f |ting sys|tem. Fo|
|00000650| 72 20 65 78 61 6d 70 6c | 65 2c 20 6f 6e 20 61 20 |r exampl|e, on a |
|00000660| 0a 63 6f 6d 70 69 6c 65 | 72 20 74 68 61 74 20 75 |.compile|r that u|
|00000670| 73 65 73 20 67 61 72 62 | 61 67 65 20 63 6f 6c 6c |ses garb|age coll|
|00000680| 65 63 74 69 6f 6e 20 69 | 74 20 6d 69 67 68 74 20 |ection i|t might |
|00000690| 6a 75 73 74 20 73 65 74 | 20 61 20 66 6c 61 67 20 |just set| a flag |
|000006a0| 69 6e 20 61 6e 20 0a 69 | 6e 74 65 72 6e 61 6c 6c |in an .i|nternall|
|000006b0| 79 2d 6d 61 69 6e 74 61 | 69 6e 65 64 20 74 61 62 |y-mainta|ined tab|
|000006c0| 6c 65 20 69 6e 64 69 63 | 61 74 69 6e 67 20 74 68 |le indic|ating th|
|000006d0| 61 74 20 74 68 65 20 62 | 6c 6f 63 6b 20 63 61 6e |at the b|lock can|
|000006e0| 20 62 65 20 0a 67 61 72 | 62 61 67 65 2d 63 6f 6c | be .gar|bage-col|
|000006f0| 6c 65 63 74 65 64 2e 0a | 20 20 57 68 79 3f 20 20 |lected..| Why? |
|00000700| 46 6f 72 20 6f 6e 65 20 | 74 68 69 6e 67 2c 20 6d |For one |thing, m|
|00000710| 65 6d 6f 72 79 20 61 6c | 6c 6f 63 61 74 69 6f 6e |emory al|location|
|00000720| 20 69 73 20 6f 6e 65 20 | 6f 66 20 74 68 65 20 73 | is one |of the s|
|00000730| 6c 6f 77 65 73 74 20 74 | 68 69 6e 67 73 20 61 20 |lowest t|hings a |
|00000740| 43 20 0a 70 72 6f 67 72 | 61 6d 20 63 61 6e 20 64 |C .progr|am can d|
|00000750| 6f 20 61 6e 64 20 69 66 | 20 74 68 65 20 6d 61 6c |o and if| the mal|
|00000760| 6c 6f 63 28 29 20 70 61 | 63 6b 61 67 65 20 64 6f |loc() pa|ckage do|
|00000770| 65 73 6e 27 74 20 68 61 | 76 65 20 74 6f 20 61 63 |esn't ha|ve to ac|
|00000780| 74 75 61 6c 6c 79 20 0a | 72 65 71 75 65 73 74 20 |tually .|request |
|00000790| 6d 65 6d 6f 72 79 20 66 | 72 6f 6d 20 61 6e 64 20 |memory f|rom and |
|000007a0| 72 65 6c 65 61 73 65 20 | 69 74 20 74 6f 20 74 68 |release |it to th|
|000007b0| 65 20 4f 53 20 74 68 65 | 6e 20 69 74 20 63 61 6e |e OS the|n it can|
|000007c0| 20 72 75 6e 20 66 61 73 | 74 65 72 2c 20 0a 63 61 | run fas|ter, .ca|
|000007d0| 75 73 65 20 6c 65 73 73 | 20 66 72 61 67 6d 65 6e |use less| fragmen|
|000007e0| 74 61 74 69 6f 6e 2c 20 | 61 6c 6c 6f 77 20 47 43 |tation, |allow GC|
|000007f0| 2c 20 65 74 63 2e 20 20 | 4f 66 20 63 6f 75 72 73 |, etc. |Of cours|
|00000800| 65 20 6e 6f 6e 65 20 6f | 66 20 74 68 65 73 65 20 |e none o|f these |
|00000810| 0a 62 65 6e 65 66 69 74 | 73 20 61 72 65 20 67 75 |.benefit|s are gu|
|00000820| 61 72 61 6e 74 65 65 64 | 2e 20 3a 29 0a 0a 2f 2a |aranteed|. :)../*|
|00000830| 2a 4a 61 6d 65 73 20 52 | 6f 62 69 6e 73 6f 6e 2a |*James R|obinson*|
|00000840| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000850| 2a 2a 2a 2a 2a 2a 20 20 | 20 20 20 20 20 20 20 20 |****** | |
|00000860| 20 20 0a 20 20 22 41 6e | 20 69 6d 70 6f 72 74 61 | . "An| importa|
|00000870| 6e 74 20 67 6f 61 6c 20 | 6f 66 20 61 6c 6d 6f 73 |nt goal |of almos|
|00000880| 74 20 65 76 65 72 79 20 | 67 72 61 70 68 69 63 73 |t every |graphics|
|00000890| 20 70 72 6f 67 72 61 6d | 20 69 73 20 74 6f 20 64 | program| is to d|
|000008a0| 72 61 77 20 70 69 63 74 | 75 72 65 73 20 6f 6e 0a |raw pict|ures on.|
|000008b0| 20 74 68 65 20 73 63 72 | 65 65 6e 2e 22 20 20 20 | the scr|een." |
|000008c0| 20 2d 2d 20 4e 65 69 64 | 65 72 2c 20 44 61 76 69 | -- Neid|er, Davi|
|000008d0| 73 20 26 20 57 6f 6f 2c | 20 5f 4f 70 65 6e 47 4c |s & Woo,| _OpenGL|
|000008e0| 5f 50 72 6f 67 72 61 6d | 6d 69 6e 67 5f 47 75 69 |_Program|ming_Gui|
|000008f0| 64 65 5f 2c 20 43 68 61 | 70 74 65 72 20 31 30 0a |de_, Cha|pter 10.|
|00000900| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000910| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000920| 20 20 20 20 20 20 20 2a | 2a 2a 2a 2a 2a 2a 2a 2a | *|********|
|00000930| 2a 2a 2a 2a 6a 61 6d 65 | 73 2d 72 6f 62 69 6e 73 |****jame|s-robins|
|00000940| 6f 6e 40 75 69 6f 77 61 | 2e 65 64 75 2a 2a 2f 0a |on@uiowa|.edu**/.|
+--------+-------------------------+-------------------------+--------+--------+